<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>expresstion</title>
</head>

<body>
    <script>
        let ex = 'each(endpoint=192.168.1.23 metric=22 if_index=10 if_type=vlan)';
        function getQueryString(ex) {
            let reg = /[a-z0-9._]*=[a-z0-9._]*/gi;
            let r = ex.match(reg);
            if (r != null) {
                return r;
            };
            return null;
        }
        console.log(getQueryString(ex))
    </script>
</body>

</html>